/**
 * 
 */
package com.haisen.lee.domain;

import com.haisen.lee.util.FormItemType;

/**
 * @author Haisen Lee
 * 
 */
public class CheckBox extends FormItem {

	private boolean checked;

	/**
	 * 
	 */
	public CheckBox() {
		super();
		this.setFormItemType(FormItemType.checkbox);
	}

	@Override
	public int hashCode() {
		if (this.getFormItemId() != null && this.getFormItemId().length() > 0) {
			return this.getFormItemId().hashCode();
		} else if (this.getFormItemName() != null
				&& this.getFormItemName().length() > 0) {
			return this.getFormItemName().hashCode();
		} else {
			return -1;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof CheckBox)) {
			return false;
		}
		CheckBox other = (CheckBox) obj;
		return this.getFormItemId().equals(other.getFormItemId());
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

}
